import unittest, os
from django.test import TestCase
from django.test.client import Client
from models import *

class CountriesTest(TestCase):
    fixtures = ['countries_data',]

    def test_ajax(self):
        client = Client()
        self.failIfEqual(len(Country.objects.all()), 0)
        for country in Country.objects.all():
            response = client.get(country.get_ajax_url())
            self.assertEqual(response.status_code, 200)
            country.has_regions()
